package xyz.molzhao.alink.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;

/**
 * 文件存储上下文
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StorageContext {
    //上传的文件
    private MultipartFile file;

    //文件目录
    private String directory;

    //时间标记
    private boolean timeFlag;

    //文件名
    private String fileName;

    //是否使用https
    private boolean useHttps = true;

    private InputStream inputStream;

    public StorageContext(MultipartFile file, String directory, boolean timeFlag, String fileName) {
        this(file, directory, timeFlag, fileName, true, null);
    }

    public StorageContext(InputStream inputStream, String directory, boolean timeFlag, String fileName) {
        this(null, directory, timeFlag, fileName, true, inputStream);
    }
}
